package com.example.app2.Template;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.example.app2.BroadcastActivity1;

//标准广播接收器
public class StandardReceiver extends BroadcastReceiver {

    private static final String STANDARD_ACTION = "LLKLKL";

    public static int i=0;


    //一旦接受到标准广播，马上触发接收器的onReceive（）方法
    @Override
    public void onReceive(Context context, Intent intent) {

        Log.d("xxf", "onReceive:广播收到了  在外面 "+i);

        if (intent != null && intent.getAction().equals(STANDARD_ACTION)) {

            String a = intent.getStringExtra("a");
            Log.d("xxf", "onReceive:广播收到了  传过来的值 "+a);
            //表示广播接受到了并修改了状态
            i=1;

            Log.d("xxf", "onReceive:广播收到了  进来了 "+i);

        }

    }
}
